import 'package:flutter/material.dart';
import 'package:flutter_eve_plugin/components/ye_xiu/checkpoint/checkpoint_pass_item.dart';
import 'package:flutter_eve_plugin/store/main.dart';
import 'package:flutter_eve_plugin/store_vm/app_vm.dart';
import 'package:flutter_eve_plugin/utils/screen_util.dart';
import 'package:flutter_redux/flutter_redux.dart';

class CheckpointPassRankListWidget extends StatelessWidget {
  const CheckpointPassRankListWidget({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return StoreConnector<AppState, AppStateViewModel>(converter: (store) {
      return AppStateViewModel(state: store.state);
    }, builder: (context, vm) {
      var dungeonRank = vm.state.yeXiuState.checkpointState.dungeonRank;
      var stages = vm.state.yeXiuState.checkpointState.checkpointStages;
      return Padding(
        padding: EdgeInsets.only(top: setRatio(127)),
        child: ListView.separated(
          itemCount: dungeonRank?.rankItems?.length ?? 0,
          itemBuilder: (context, index) {
            var info = dungeonRank?.rankItems[index];
            return CheckpointPassRankItemWidget(
                index: index,
                info: info,
                vip: (stages?.isVIP ?? 0) > 0 ? true : false);
          },
          separatorBuilder: (context, index) {
            return Container(
              margin: EdgeInsets.only(left: setRatio(15), right: setRatio(15)),
              height: setRatio(0.5),
              color: Color(0x4FFFFFFF),
            );
          },
        ),
      );
    });
  }
}
